from port_job.day04.分装requests类 import SendMethod


class Event:
    def __init__(self):
        self.url = 'http://127.0.0.1:8000'
    def add_event(self, payload):
        method = 'post'
        url = self.url + '/api/add_event/'
        return SendMethod.send_metod(method=method, url=url, data= payload)
    def get_event(self,eid=None,name=None):
        method = 'get'
        url = self.url + '/api/get_event_list/'
        payload = {"eid": eid, 'name':name}
        return SendMethod.send_metod(method=method, url=url, params=payload)
if __name__ == '__main__':
    payload = {
        "eid": "798",
        "name": "小康发布会",
        "limit": "100",
        "status": "1",
        "address": "阳光花园",
        "start_time": "2022-07-19",
    }
# print(Event().add_event('payload'))
print(Event().get_event(798))
print(Event().get_event(name='小康发布会'))



